<?php /*a:1:{s:62:"C:\xampp\htdocs\application\index\view\work\history_works.html";i:1642347650;}*/ ?>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>时光轴 - 光年(Light Year Admin V4)后台管理系统模板</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="Light Year Admin V4是一个后台管理系统的HTML模板，基于Bootstrap v4.4.1。">
    <meta name="author" content="yinqi">
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/materialdesignicons.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/js/jquery-confirm/jquery-confirm.min.css">
    <link href="/static/css/style.min.css" rel="stylesheet">


</head>

<body>
<div class="container-fluid p-t-15">

    <div class="row">

        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar d-flex flex-column flex-md-row">
                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" href="<?php echo url('addWork'); ?>"><i class="mdi mdi-plus"></i> 新增工作经历</a>
                    </div>
                </div>
                <header class="card-header">
                    <div class="card-title">工作经历</div>
                </header>
                <div class="card-body">

                    <ul class="lyear-timeline lyear-timeline-center">
                        <li class="lyear-timeline-date">
                            <time><?php echo htmlentities($user['realname']); ?></time>
                        </li>
                        <?php foreach($works as $work): ?>
                        <li class="lyear-timeline-item">
                            <div class="lyear-timeline-item-action">
                                <time>开始时间：<?php echo date("Y-m-d",$work['start_time']); ?></time>
                                <br/>
                                <time>结束时间：<?php echo date("Y-m-d",$work['end_time']); ?></time>
                            </div>
                            <div class="lyear-timeline-item-dot"><span class="badge badge-info"></span></div>
                            <div class="lyear-timeline-item-content">
                                <div class="card bg-success">
                                    <div class="card-header">
                                        <div class="card-title">
                                            <?php echo htmlentities($work['title']); ?>
                                        </div>
                                        <ul class="card-actions">
                                            <li><a href="#" onclick="delWork(<?php echo htmlentities($work['id']); ?>)"><i class="mdi mdi-close"></i></a></li>
                                        </ul>
                                    </div>

                                    <div class="card-body">
                                        <?php echo htmlentities($work['content']); ?>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <?php endforeach; if(count($works)==0): ?>
                        <div class="alert alert-secondary" role="alert">暂无工作上传，赶快上传吧</div>
                        <?php endif; ?>

                    </ul>

                </div>
            </div>
        </div>

    </div>

</div>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/popper.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/main.min.js"></script>
<script type="text/javascript" src="/static/js/jquery-confirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="/static/js/msg.js"></script>
<script>
    function delWork(id){
        $.alert({
            title: '确认删除',
            content: '你是否确认删除此工作经历',
            type: 'orange',
            typeAnimated: true,
            animation: 'scale',
            closeAnimation: 'scale',
            buttons: {
                confirm: {
                    text: '确认',
                    btnClass: 'btn-blue',
                    action: function() {
                        del(id);
                    }
                },
                cancel: {
                    text: '取消',
                    action: function() {}
                }
            }
        });
    }
    function del(id){
        $.ajax({
            url:'/index/work/delWork',
            method:"post",
            data:{
                id
            },
            dataType:"json",
            success:function (res){
                if(res.code){
                    msgShow.success(res.msg);
                    setTimeout(function (){
                        location.reload();
                    },2000)
                }else{
                    msgShow.error(res.msg);
                }
            }
        })
    }
</script>
</body>
</html>